package emulator.unittest.hardware.nmos6502;

import static org.junit.Assert.*;

import org.junit.Test;

import emulator.hardware.nmos6502.FloatHelper;

public class FloatHelperTest {

	@Test
	public void testFromMFLPT_Plus() {
		int[] bytes = { 0x8F, 0x5B, 0xFE, 0x00, 0x00 };
		assertEquals(28159, FloatHelper.fromMFLPT(bytes), 0.0);
	}

	@Test
	public void testFromMFLPT_Minus() {
		int[] bytes = { 0x8F, 0xDB, 0xFE, 0x00, 0x00 };
		assertEquals(-28159, FloatHelper.fromMFLPT(bytes), 0.0);
	}

	@Test
	public void testFromFLPT_Plus() {
		int[] bytes = { 0x8F, 0xDB, 0xFE, 0x00, 0x00, 0x00 };
		assertEquals(28159, FloatHelper.fromFLPT(bytes), 0.0);
	}

	@Test
	public void testFromFLPT_Minus() {
		int[] bytes = { 0x8F, 0xDB, 0xFE, 0x00, 0x00, 0x80 };
		assertEquals(-28159, FloatHelper.fromFLPT(bytes), 0.0);
	}

}
